set(tgt aui) 

#######################################################################
#generate proto file into cpp & h file
set (proto_gen_dir ${CMAKE_CURRENT_BINARY_DIR}/generated_code)
set (gen_sh ${CMAKE_CURRENT_SOURCE_DIR}/compile_proto.sh)

#EXEC_PROGRAM("chmod +x ${CMAKE_CURRENT_SOURCE_DIR}/*.sh")
#EXEC_PROGRAM("${gen_sh} ${DAF_PATH} ${proto_gen_dir}")

#remove gcc compile warining when compile google protobuf source file
aux_source_directory(${proto_gen_dir} protobuf_src_list)
set_property(
    SOURCE ${protobuf_src_list}
    APPEND_STRING
    PROPERTY COMPILE_FLAGS
    "-w"
    )

list(APPEND LIST_ALL_SOURCE_DIR .
    ${proto_gen_dir}
    )

include_directories(
    ${proto_gen_dir}
    ${LIST_ALL_SOURCE_DIR}
    )

list(APPEND need_libs ${dependence_libs}
    pthread
    vbase
    #protobuf
    )

list(APPEND need_libs 
    wx_baseu-3.0
    )

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
    list(APPEND need_libs 
        wx_osx_cocoau_core-3.0
        wx_osx_cocoau_aui-3.0
        #wx_osx_cocoau_qa-3.0 
        #wx_osx_cocoau_adv-3.0
        #wxregexu-3.0
        )

    set(frame "-framework IOKit" 
        "-framework Carbon" 
        "-framework Cocoa" 
        "-framework AudioToolbox" 
        "-framework System" 
        "-framework OpenGL")

elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
    list(APPEND need_libs 
        ${wx_libs}
        )
endif()

#scan
FOREACH(EVERY_DIR ${LIST_ALL_SOURCE_DIR})
    aux_source_directory(${EVERY_DIR} SRC_LIST_TMP)
    list(APPEND SRC_LIST_ALL ${SRC_LIST_TMP})
ENDFOREACH(EVERY_DIR) #end foreach

add_executable(${tgt} ${SRC_LIST_ALL})
target_link_libraries(${tgt}
    ${need_libs}
    ${frame}
    )

install(TARGETS ${tgt}
    #LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin
    )

